<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:comp="http://java.sun.com/jsf/composite/comp">


    <h:head>

        <context-param>  
            <param-name>primefaces.THEME</param-name>  
            <param-value>redmond</param-value>  
        </context-param>
        <f:facet name="first">
            <meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
            <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
            <title>tCloud</title>
            <h:outputStylesheet name="css/jsfcrud.css"/>
        </f:facet>

        <style type="text/css">
            .ui-layout {
                width: 800px;                    
            }
            .ui-layout-north {
                background-color: #141414;
            }

            .ui-layout-north .ui-layout-unit-content {
                background-color: #141414;
                text-align: right;
                color: whitesmoke;
            }
            .noBorders tr, .noBorders td {
                background: none !important;
                border: none !important;
            }

        </style>
    </h:head>


    <h:body>
        <p:layout fullPage="true">
            <h:form>
                <p:overlayPanel id="loginPanel" for="loginButton" hideEffect="fade">
                    <comp:loginDialog />
                </p:overlayPanel>

                <p:layoutUnit id="top" position="north" size="45"><h:panelGrid columns="4" style="float: right">

                        <h:outputLabel value="Welcome"/>
                        <h:outputLabel rendered="#{userManagedBean.loggedIn}" value="#{userManagedBean.user.name}"/>
                        <p:commandLink id="loginButton" value="Login" rendered="#{!userManagedBean.loggedIn}" style="color: whitesmoke"/>
                        <p:commandLink id="logout" value="Logout" rendered="#{userManagedBean.loggedIn}" action="#{userManagedBean.logout()}" style="color: whitesmoke"/>

                    </h:panelGrid>
                </p:layoutUnit>
            </h:form>
            <p:layoutUnit id="left" position="west" size="200" header="Manage account">
                <h:form>
                    <h:panelGrid rendered="#{userManagedBean.loggedIn}" columns="1">
                        <h:commandLink value="My files" action="files.xhtml?faces-redirect=true"/>
                        <h:commandLink value="Shared files" />
                        <h:commandLink value="Logs"/>
                        <h:commandLink value="Edit profle" action="editUser.xhtml?faces-redirect=true"/>
                    </h:panelGrid>
                    <h:panelGrid rendered="#{!userManagedBean.loggedIn}" columns="1">
                        <h:commandLink value="Create account" action="createUser.xhtml?faces-redirect=true"/>
                    </h:panelGrid>
                </h:form>
            </p:layoutUnit>
            <p:layoutUnit id="center" position="center">
                <ui:insert name="content">Default Body</ui:insert>                    
            </p:layoutUnit>

        </p:layout>
    </h:body>

</html>
